<template>
  <div>
    <h2>申请主体信息</h2>
    <hr>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="公寓名称:" label-width="200px">
        {{ formInline.detail.name }}
      </el-form-item>
      <el-form-item label="类型:" label-width="300px">
        {{ formInline.detail.type == 0 ? '个人职业房东' : '公司化公寓' }}
      </el-form-item>
      <br>
      <el-form-item label="公司名称:" label-width="200px">
        {{ formInline.detail.name }}
      </el-form-item>
      <el-form-item label="联系人:" label-width="300px">
        {{ formInline.detail.name }}
      </el-form-item>
      <br>
      <el-form-item label="手机号:" label-width="190px">
        {{ formInline.sysUser.phonenumber }}
      </el-form-item>
      <el-form-item label="申请时间:" label-width="300px">
        {{ formInline.detail.createTime }}
      </el-form-item>
      <br>
      <el-form-item label="法人姓名:" label-width="190px">
        {{ formInline.detail.corporation }}
      </el-form-item>
      <el-form-item label="法人身份证:" label-width="300px">
        {{ formInline.detail.certNum }}
      </el-form-item>
      <br>
      <el-form-item label="公司地址:" label-width="190px">
        {{ formInline.detail.address }}
      </el-form-item>
      <br>
      <el-form-item label="法人身份证:" label-width="190px">
        <el-image style="width: 100px; height: 100px" :src="formInline.detail.certPicture"></el-image>
        <el-image style="width: 100px; height: 100px" :src="formInline.detail.certPicture2"></el-image>
        <el-image style="width: 100px; height: 100px" :src="formInline.detail.certPicture3"></el-image>
      </el-form-item>
    </el-form>
    <h2>贷款详细信息</h2>
    <hr>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="date"
        label="序号">
        <template v-slot="code">
          {{ '1' }}
        </template>
      </el-table-column>
      <el-table-column
        prop="roomName"
        label="承租房间">
      </el-table-column>
      <el-table-column
        prop="tenantName"
        label="租客姓名">
      </el-table-column>
      <el-table-column
        prop="tenantPhone"
        label="租客手机号">
      </el-table-column>
      <el-table-column
        prop="shouldMonthRent"
        label="月租金">
        <template v-slot="code">
          {{ code.row.shouldMonthRent + '元' }}
        </template>
      </el-table-column>
      <el-table-column
        prop="factoringPeriod"
        label="借款周期">
        <template v-slot="code">
          {{ code.row.factoringPeriod + '月' }}
        </template>
      </el-table-column>
      <el-table-column
        prop="factoringInterest"
        label="保理利息">
        <template v-slot="code">
          {{ code.row.factoringInterest + '元' }}
        </template>
      </el-table-column>
      <el-table-column
        prop="borrowedStart"
        label="租期">
        <template v-slot="code">
          {{ code.row.borrowedStart + ' 至 ' + code.row.borrowedEnd }}
        </template>
      </el-table-column>
      <el-table-column
        fixed="right"
        label="操作"
        width="100">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="应收租约合计:" label-width="190px">
        <el-input v-model="formInline.jrFactoring.rentMoney+'元'" disabled=""></el-input>
      </el-form-item>
      <el-form-item label="保理授信金额:" label-width="300px">
        <el-input v-model="formInline.jrFactoring.factoringCreditMoney+'元'" disabled=""></el-input>
      </el-form-item>
      <br>
      <el-form-item label="服务费:" label-width="190px">
        <el-input v-model="formInline.jrFactoring.serviceMoney+'元'" disabled=""></el-input>
      </el-form-item>
      <el-form-item label="保理利息:" label-width="300px">
        <el-input v-model="formInline.jrFactoring.factoringAdditionalMoney+'元'" disabled=""></el-input>
      </el-form-item>
      <br>
      <el-form-item label="实收保理额度合计:" label-width="190px">
        <el-input v-model="formInline.jrFactoring.factoringTrueMoney+'元'" disabled=""></el-input>
      </el-form-item>
      <br>
      <el-form-item label="维数公寓收取服务费:" label-width="240px">
        <el-input v-model="formInline.sum"></el-input>
      </el-form-item>
    </el-form>
    <el-button v-if="formInline.applyState_Show_Hidden==1?true:false" type="primary" @click="test5">初审通过</el-button>
    <el-button v-if="formInline.applyState_Show_Hidden==1?true:false" type="primary" @click="test6">初审不通过
    </el-button>
    <el-button v-if="formInline.applyState_Show_Hidden==2?true:false" type="primary" @click="test5">复审通过</el-button>
    <el-button v-if="formInline.applyState_Show_Hidden==2?true:false" type="primary" @click="test6">复审不通过
    </el-button>

    <el-dialog title="应收租约保理详情" :visible.sync="dialogFormVisible">
      <h2>基本信息</h2>
      <el-form :inline="true" :model="form" class="demo-form-inline">
        <el-form-item label="租客姓名" label-width="200px">
          {{ form.contractDetail.tenantName }}
        </el-form-item>
        <el-form-item label="租客身份证号" label-width="200px">
          {{ form.contractDetail.tenantCardNo }}
        </el-form-item>
        <br>
        <el-form-item label="租客手机号" label-width="200px">
          {{ form.contractDetail.tenantPhone }}
        </el-form-item>
        <el-form-item label="待收租金合计" label-width="200px">
          {{ form.jrFactoring.rentMoney + '元' }}
        </el-form-item>
        <br>
        <el-form-item label="应收保理金额" label-width="200px">
          {{ form.jrFactoringDetail.shouldMonthRent + '元' }}
        </el-form-item>
        <el-form-item label="保理授信比例" label-width="200px">
          {{ form.creditLine + '%' }}
        </el-form-item>
        <br>
        <el-form-item label="保理利息" label-width="200px">
          {{ form.jrFactoringDetail.factoringInterest + '元（保理年化利率8%）' }}
        </el-form-item>
        <el-form-item label="一次性服务费" label-width="200px">
          {{ form.oneServiceFee + '元' }}
        </el-form-item>
        <br>
        <el-form-item label="实收保理金额" label-width="200px">
          {{ form.factoringTrueMoney + '元' }}
        </el-form-item>
        <el-form-item label="退款金额" label-width="200px">
          {{ form.refundAmount + '元' }}
        </el-form-item>
        <br>
        <el-form-item label="租约起始时期" label-width="200px">
          {{ form.contractDetail.startDate }}
        </el-form-item>
        <el-form-item label="租约终止时期" label-width="200px">
          {{ form.contractDetail.endDate }}
        </el-form-item>
        <br>
        <el-form-item label="还款周期" label-width="200px">
          {{ form.contractDetail.paymentType + '个月' }}
        </el-form-item>
        <el-form-item label="还款账期" label-width="200px">
          {{ form.jrFactoringDetail.factoringPeriod + '个月' }}
        </el-form-item>
        <br>
        <el-form-item label="周期还款金额" label-width="200px">
          {{ form.cycleAmount + '元' }}
        </el-form-item>
        <el-form-item label="尾款退款时间" label-width="200px">
          {{ form.jrFactoringDetail.borrowedEnd }}
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {factoringDetailsView, test5, test6} from "@/api/wishu/finance/finance";

export default {
  name: "index.vue",
  data() {
    return {
      formInline: {},
      tableData: [],
      dialogFormVisible: false,
      formLabelWidth: '120px',
      form: {},
    }
  }, methods: {
    handleClick(row) {
      factoringDetailsView(row).then(res => {
        this.form = res.data;
        this.dialogFormVisible = true;
      })
    },
    test6() {
      test6(this.formInline).then(res => {
        if (res.code == 200) {
          this.$message.success("操作成功");
          this.$router.push("/jinlong/rent");
        }
      });
    },
    test5() {
      test5(this.formInline).then(res => {
        if (res.code == 200) {
          this.$message.success("通过");
          this.$router.push("/jinlong/rent");
        }
      });
    }
  }, created() {
    this.formInline = this.$route.query.dataParam;
    console.log(this.formInline);
    this.tableData = this.formInline.factoringDetails;
  }
}
</script>

<style scoped>

</style>
